//
//  FoodOrderModel.swift
//
//  Created by 邱仙凯 on 2021/9/18
//  Copyright (c) . All rights reserved.
//

import Foundation
import ObjectMapper

public struct ZyaFoodOrderModel: Mappable {

  // MARK: Declaration for string constants to be used to decode and also serialize.
  private struct SerializationKeys {
    static let sTemp = "s_temp"
    static let sAuditId = "s_audit_id"
    static let sProviderNm = "s_provider_nm"
    static let sAuditDt = "s_audit_dt"
    static let sCreateTm = "s_create_tm"
    static let sOrgId = "s_org_id"
    static let sUpdateTm = "s_update_tm"
    static let sStaffNm = "s_staff_nm"
    static let sAuditMark = "s_audit_mark"
    static let idKey = "id_key"
    static let sSumNumber = "s_sum_number"
    static let rn = "rn"
    static let sProviderId = "s_provider_id"
    static let sTotalMoney = "s_total_money"
    static let sNo = "s_no"
    static let sAuditNm = "s_audit_nm"
    static let sRemark = "s_remark"
    static let sOrgNm = "s_org_nm"
    static let sClientId = "s_client_id"
    static let sSalersId = "s_salers_id"
    static let sBranchClientNm = "s_branch_client_nm"
    static let sDate = "s_date"
    static let sBranchClientId = "s_branch_client_id"
    static let sStaffId = "s_staff_id"
    static let sStatus = "s_status"
    static let sSalersNm = "s_salers_nm"
    static let sClientNm = "s_client_nm"
    static let detail = "detail"
      static let sStorageId = "s_storage_id"
      static let sStorageNm = "s_storage_nm"
      static let sCarNo = "s_car_no"
  }

  // MARK: Properties
  public var sTemp: String?
  public var sAuditId: String?
  public var sProviderNm: String?
  public var sAuditDt: String?
  public var sCreateTm: String?
  public var sOrgId: String?
  public var sUpdateTm: String?
  public var sStaffNm: String?
  public var sAuditMark: String?
  public var idKey: String?
  public var sSumNumber: Double?
  public var rn: Int?
  public var sProviderId: String?
  public var sTotalMoney: Double?
  public var sNo: String?
  public var sAuditNm: String?
  public var sRemark: String?
  public var sOrgNm: String?
  public var sClientId: String?
  public var sSalersId: String?
  public var sBranchClientNm: String?
  public var sDate: String?
  public var sBranchClientId: String?
  public var sStaffId: String?
  public var sStatus: String?
  public var sSalersNm: String?
  public var sClientNm: String?
    public var detail = [ZyaFoodOrderDetail]()
    public var showPaopao = false
    public var avaliableMoney: String?
    public var sStorageId: Int?
    public var sStorageNm: String?
    public var sCarNo: String?
    
  // MARK: ObjectMapper Initializers
  /// Map a JSON object to this class using ObjectMapper.
  ///
  /// - parameter map: A mapping from ObjectMapper.
  public init?(map: Map){

  }

  /// Map a JSON object to this class using ObjectMapper.
  ///
  /// - parameter map: A mapping from ObjectMapper.
  public mutating func mapping(map: Map) {
    sTemp <- map[SerializationKeys.sTemp]
    sAuditId <- (map[SerializationKeys.sAuditId],StringTransform())
    sProviderNm <- map[SerializationKeys.sProviderNm]
    sAuditDt <- map[SerializationKeys.sAuditDt]
    sCreateTm <- map[SerializationKeys.sCreateTm]
    sOrgId <- (map[SerializationKeys.sOrgId],StringTransform())
    sUpdateTm <- map[SerializationKeys.sUpdateTm]
    sStaffNm <- map[SerializationKeys.sStaffNm]
    sAuditMark <- (map[SerializationKeys.sAuditMark],StringTransform())
    idKey <- (map[SerializationKeys.idKey],StringTransform())
    sSumNumber <- map[SerializationKeys.sSumNumber]
    rn <- map[SerializationKeys.rn]
    sProviderId <- (map[SerializationKeys.sProviderId],StringTransform())
    sTotalMoney <- map[SerializationKeys.sTotalMoney]
    sNo <- map[SerializationKeys.sNo]
    sAuditNm <- map[SerializationKeys.sAuditNm]
    sRemark <- map[SerializationKeys.sRemark]
    sOrgNm <- map[SerializationKeys.sOrgNm]
    sClientId <- (map[SerializationKeys.sClientId],StringTransform())
    sSalersId <- (map[SerializationKeys.sSalersId],StringTransform())
    sBranchClientNm <- map[SerializationKeys.sBranchClientNm]
    sDate <- map[SerializationKeys.sDate]
    sBranchClientId <- (map[SerializationKeys.sBranchClientId],StringTransform())
    sStaffId <- (map[SerializationKeys.sStaffId],StringTransform())
    sStatus <- map[SerializationKeys.sStatus]
    sSalersNm <- map[SerializationKeys.sSalersNm]
    sClientNm <- map[SerializationKeys.sClientNm]
    detail <- map[SerializationKeys.detail]
      sStorageId <- map[SerializationKeys.sStorageId]
      sStorageNm <- (map[SerializationKeys.sStorageNm], StringTransform())
      sCarNo <- (map[SerializationKeys.sCarNo], StringTransform())
  }

  /// Generates description of the object in the form of a NSDictionary.
  ///
  /// - returns: A Key value pair containing all valid values in the object.
  public func dictionaryRepresentation() -> [String: Any] {
    var dictionary: [String: Any] = [:]
    if let value = sTemp { dictionary[SerializationKeys.sTemp] = value }
    if let value = sAuditId { dictionary[SerializationKeys.sAuditId] = value }
    if let value = sProviderNm { dictionary[SerializationKeys.sProviderNm] = value }
    if let value = sAuditDt { dictionary[SerializationKeys.sAuditDt] = value }
    if let value = sCreateTm { dictionary[SerializationKeys.sCreateTm] = value }
    if let value = sOrgId { dictionary[SerializationKeys.sOrgId] = value }
    if let value = sUpdateTm { dictionary[SerializationKeys.sUpdateTm] = value }
    if let value = sStaffNm { dictionary[SerializationKeys.sStaffNm] = value }
      if let value = sAuditMark { dictionary[SerializationKeys.sAuditMark] = value } else {
          dictionary[SerializationKeys.sAuditMark] = "0"
      }
      if let value = idKey { dictionary[SerializationKeys.idKey] = value } else {
          dictionary[SerializationKeys.idKey] = ""
      }
    if let value = sSumNumber { dictionary[SerializationKeys.sSumNumber] = value }
    if let value = rn { dictionary[SerializationKeys.rn] = value }
    if let value = sProviderId { dictionary[SerializationKeys.sProviderId] = value }
    if let value = sTotalMoney { dictionary[SerializationKeys.sTotalMoney] = value }
    if let value = sNo { dictionary[SerializationKeys.sNo] = value }
    if let value = sAuditNm { dictionary[SerializationKeys.sAuditNm] = value }
    if let value = sRemark { dictionary[SerializationKeys.sRemark] = value }
    if let value = sOrgNm { dictionary[SerializationKeys.sOrgNm] = value }
    if let value = sClientId { dictionary[SerializationKeys.sClientId] = value }
    if let value = sSalersId { dictionary[SerializationKeys.sSalersId] = value }
    if let value = sBranchClientNm { dictionary[SerializationKeys.sBranchClientNm] = value }
    if let value = sDate { dictionary[SerializationKeys.sDate] = value }
    if let value = sBranchClientId { dictionary[SerializationKeys.sBranchClientId] = value }
    if let value = sStaffId { dictionary[SerializationKeys.sStaffId] = value }
      if let value = sStatus { dictionary[SerializationKeys.sStatus] = value } else {
          dictionary[SerializationKeys.sStatus] = "0"
      }
    if let value = sSalersNm { dictionary[SerializationKeys.sSalersNm] = value }
    if let value = sClientNm { dictionary[SerializationKeys.sClientNm] = value }
      if let value = sStorageId { dictionary[SerializationKeys.sStorageId] = value }
      if let value = sStorageNm { dictionary[SerializationKeys.sStorageNm] = value }
      if let value = sCarNo { dictionary[SerializationKeys.sCarNo] = value }
      dictionary[SerializationKeys.detail] = detail.map { $0.dictionaryRepresentation() }
    return dictionary
  }

}
